package com.jc.oms.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;

import com.jc.common.util.IPUtil;

@Controller
public class BaseController {
	public Logger getLoger() {
		return LoggerFactory.getLogger(this.getClass());
	}
	
	public String getRequestIP(HttpServletRequest request) {
		return IPUtil.getIPAddress(request);
	}
	
	
	
	
	/*
	 * 
	public RequestHeader getRequestHeader(HttpServletRequest request) {
		RequestHeader requestHeader = new RequestHeader();
		if(StringUtils.isNotBlank(request.getHeader("appVersion"))) {
			requestHeader.setAppVersion(request.getHeader("appVersion"));
		}
		if(StringUtils.isNotBlank(request.getHeader("phoneUUID"))) {
			requestHeader.setPhoneUUID(request.getHeader("phoneUUID"));
		}
		
		if(StringUtils.isNotBlank(request.getHeader("phoneClientType"))) {
			requestHeader.setPhoneClientType(request.getHeader("phoneClientType"));
		}
		
		if(StringUtils.isNotBlank(request.getHeader("phoneSystemVersion"))) {
			requestHeader.setPhoneSystemVersion(request.getHeader("phoneSystemVersion"));
		}
		
		if(StringUtils.isNotBlank(request.getHeader("userId"))) {
			requestHeader.setUserId(Long.valueOf(request.getHeader("userId")));
		}
		
		if(StringUtils.isNotBlank(request.getHeader("userToken"))) {
			requestHeader.setUserToken(request.getHeader("userToken"));
		}
		return requestHeader;
	}
	*/
	

}
